package com.lmpop.createIndex.search;

import com.lmpop.frame.util.Config;

public class ProperUtil
{
  public String getFilePathByModel(String index_model)
  {
    Config configs = new Config("indexmodel.properties");
    String index_str = configs.getString(index_model);
    String file_path = "";
    if ((!index_str.equals("")) && (index_str.indexOf("|") > -1)) {
      String[] index_attr = index_str.split("\\|");
      if (index_attr.length > 1) {
        file_path = index_attr[0];
      }
    }
    return file_path;
  }

  public String getDateStr(String in_date, String type) {
    if (in_date.equals("")) return "";
    if (in_date.length() >= 8) {
      String yeard = in_date.substring(0, 4);
      String monthd = in_date.substring(4, 6);
      String dayd = in_date.substring(6, 8);
      if (type.equals(""))
        in_date = yeard + "年" + monthd + "月" + dayd + "日";
      else {
        in_date = yeard + "-" + monthd + "-" + dayd;
      }
    }
    return in_date;
  }
}